package crmdna.user;

import java.util.TreeSet;

import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;

import crmdna.user.UserCore.UserProp;

@Entity
@Cache
public class UserEntity {
	@Id
	public String email;

	@Index
	long userId;
	@Index
	long groupId;
	TreeSet<String> privileges = new TreeSet<>(); // format is: <resource
													// type>||<resource
													// id>||<action>

	// eg: group||1||read, group||2||write

	public UserProp toProp() {
		UserProp userProp = new UserProp();
		userProp.email = email;
		userProp.userId = userId;
		userProp.groupId = groupId;

		userProp.privileges = privileges;

		return userProp;
	}
}
